/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package cn.knet.sp.ncrm.modules.customer.potentialcustomer.entity;

import java.util.Date;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import cn.knet.sp.ncrm.common.persistence.DataEntity;
import cn.knet.sp.ncrm.modules.sys.utils.DictUtils;
import cn.knet.sp.ncrm.modules.sys.utils.ProductUtils;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 潜在客户主表Entity
 *
 * @author gehaiyang
 * @version 2015-08-24
 */
public class PotentialCustomer extends DataEntity<PotentialCustomer> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long              version;        // VERSION
	private String            adminGroup1Id;        // 管理员一级分组
	private String            adminGroup2Id;        // 管理员二级分组
	private String            adminGroup3Id;        // 管理员三级分组
	private String            comparisonResult;        // COMPARISON_RESULT
	private String            contactorName;        // 联系人名称
	private String            corporationName;        // 公司名称
	private String            corporationUrl;        // 公司URL
	private String            customerStatusId;        // 客户状态
	private String            customerStatus;  // 客户状态
	private String            customerStatusDetailId;        // 客户状态明细
	private Date              dateAppointment;        // 预约时间
	private Date              dateCreated;        // 创建时间
	private Date              dateMergerd;        // 数据合并时间
	private Date              dateVisit;        // 访问时间
	private String            distStatus;        // 分配状态
	private String            email;        // 邮箱
	private String            executorId;        // 分配执行人ID
	private String 			  executorName;		//分配执行人name add by jief2016-09-10
	private String            group1Id;        // 用户一级分组
	private String            group2Id;        // 用户二级分组
	private Date              lastUpdated;        // 最后更新时间
	private Integer           mergerNum;        // 合并记录数
	private String            mobile;        // 手机
	private String            mobileOrPc;        // 设备来源
	private Integer           noReadMergerNum;        // 未读合并记录数
	private PotentialCustomer parent;        // 主数据ID
	private String            provinceId;        // 省份
	private String            realAdminGroupId;        // 真实管理员分组
	private String            realGroupId;        // 真实用户分组
	private String            sealVersionType;        // 可信 类型
	private String            source;        // 一级来源
	private String            sourceDesc;        // 二级来源
	private String            telephone;        // 电话
	private String            visitRecord;        // 访问记录
	private String            visitResult;        // 访问结果
	private String            visitResultDetailId;        // 访问结果附加ID
	private String            sourceType;        // 来源类型
	private String            lastCustomerStatusId;        // 最后客户状态
	private String            lastCustomerStatus;   // 最后客户状态
	private String            lastCustomerStatusDetailId;        // 最后客户状态明细
	private Integer           visitNum;        // 访问数量
	private String            hasAdminGroup;        // 管理员是否拥有分组
	private String            hasGroup;        // 用户是否拥有分组
	private String            lastVisitId;        // 最后访问ID
	private Date              distDate;        // 数据分配时间
	private String            distUserId;        // 数据被分配人ID
	private String            customerFeatureId;        // 客户特点
	private String            customerTypeId;        // 客户类型
	private String            customerTypeDtailId;        // 客户类型附加类型
	private String            prepaidMoney;        // 预支金额
	private String            targetProducts;        // 产品意向
	private String            contactorSex;        // 联系人性别
	private String            contactorPosition;        // 联系人职务
	private String            contactorQq;        // 联系人QQ
	private String            contactorWechat;        // 联系人微信
	private Integer           weight;        // 权重
	private String            recordVisibilityRule;        // 数据访问规则
	private String            visibilityUserId;        // 持有人ID
	private String            visibilityUserName;        // 持有人姓名
	private String            backupTelephone;        // 备用电话
	private String            industry;        // 行业
	private String            corporationAddress;        // 公司地址
	private String            delFlag;        // 删除标识
	private String[]          ids; //存放多个ID
	private Integer           flag; //标识 0：系统潜在客户 1：用户潜在客户
	private String			  customerStatusFreeze;//无意向客户状态ID
	private String			  FreezeExp;//无意向数据解禁表达式

	
	private int corporationNameOption;//公司名称是否包含
	private int contactorNameOption;//联系人是否包含
	private int mobileOption; //手机号
	private int telephoneOption;//固定电话
	private int sourceOption;//一级来源
	private int sourceDescOption;//二级来源
	
	private int corporationUrlOption;//公司网址：
	private int emailOption;//邮箱：
	private int dateVisitOption;//最新回访时间：
	private String dateVisitBeginDate;//最新回访时间 start
	private String dateVisitEndDate;//最新回访时间 end
	private int dateAppointmentOption;//预约回访时间：
	private String dateAppointmentBeginDate;//预约回访时间 start
	private String dateAppointmentEndDate;//预约回访时间 end
	private int distDateOption;//最后分配时间
	private String distDateBeginDate;//最后分配时间 start
	private String distDateEndDate;//最后分配时间 end
	
	public PotentialCustomer() {
		super();
	}

	public PotentialCustomer(String id) {
		super(id);
	}

	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Length(min = 0, max = 32, message = "管理员一级分组长度必须介于 0 和 32 之间")
	public String getAdminGroup1Id() {
		return adminGroup1Id;
	}

	public void setAdminGroup1Id(String adminGroup1Id) {
		this.adminGroup1Id = adminGroup1Id;
	}

	@Length(min = 0, max = 32, message = "管理员二级分组长度必须介于 0 和 32 之间")
	public String getAdminGroup2Id() {
		return adminGroup2Id;
	}

	public void setAdminGroup2Id(String adminGroup2Id) {
		this.adminGroup2Id = adminGroup2Id;
	}

	@Length(min = 0, max = 32, message = "管理员三级分组长度必须介于 0 和 32 之间")
	public String getAdminGroup3Id() {
		return adminGroup3Id;
	}

	public void setAdminGroup3Id(String adminGroup3Id) {
		this.adminGroup3Id = adminGroup3Id;
	}

	@Length(min = 0, max = 255, message = "COMPARISON_RESULT长度必须介于 0 和 255 之间")
	public String getComparisonResult() {
		return comparisonResult;
	}

	public void setComparisonResult(String comparisonResult) {
		if(null!=comparisonResult&&comparisonResult.length()>250){
			this.comparisonResult = comparisonResult.substring(0,250);
		}else{
			this.comparisonResult = comparisonResult;
		}
	}

	@NotBlank
	@Length(min = 0, max = 100, message = "联系人名称长度必须介于 0 和 100 之间")
	public String getContactorName() {
		return contactorName;
	}

	public void setContactorName(String contactorName) {
		if(null!=contactorName&&contactorName.length()>100){
			this.contactorName = contactorName.substring(0,100);
		}else{
			this.contactorName = contactorName;
		}
	}

	@NotBlank
	@Length(min = 0, max = 100, message = "公司名称长度必须介于 0 和 100 之间")
	public String getCorporationName() {
		return corporationName;
	}

	public void setCorporationName(String corporationName) {
		if(null!=corporationName&&corporationName.length()>100){
			this.corporationName = corporationName.substring(0,100);
		}else{
			this.corporationName = corporationName;
		}
	}

	@Length(min = 0, max = 100, message = "公司URL长度必须介于 0 和 100 之间")
	public String getCorporationUrl() {
		return corporationUrl;
	}

	public void setCorporationUrl(String corporationUrl) {
		if(null!=corporationUrl&&corporationUrl.length()>100){
			this.corporationUrl = corporationUrl.substring(0,100);
		}else{
			this.corporationUrl = corporationUrl;
		}
	}

	@Length(min = 0, max = 32, message = "客户状态长度必须介于 0 和 32 之间")
	public String getCustomerStatusId() {
		return customerStatusId;
	}

	public void setCustomerStatusId(String customerStatusId) {
		this.customerStatusId = customerStatusId;
	}

	@Length(min = 0, max = 32, message = "客户状态明细长度必须介于 0 和 32 之间")
	public String getCustomerStatusDetailId() {
		return customerStatusDetailId;
	}

	public void setCustomerStatusDetailId(String customerStatusDetailId) {
		this.customerStatusDetailId = customerStatusDetailId;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDateAppointment() {
		return dateAppointment;
	}

	public void setDateAppointment(Date dateAppointment) {
		this.dateAppointment = dateAppointment;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDateCreated() {
		return dateCreated;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDateMergerd() {
		return dateMergerd;
	}

	public void setDateMergerd(Date dateMergerd) {
		this.dateMergerd = dateMergerd;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDateVisit() {
		return dateVisit;
	}

	public void setDateVisit(Date dateVisit) {
		this.dateVisit = dateVisit;
	}

	@Length(min = 0, max = 50, message = "分配状态长度必须介于 0 和 50 之间")
	public String getDistStatus() {
		return distStatus;
	}

	public void setDistStatus(String distStatus) {
		this.distStatus = distStatus;
	}

	public String getDistStatusText() {
		return DictUtils.getDictLabel(distStatus, "POTENTIAL_DIST_STATUS", "未分配");
	}

	@Length(min = 0, max = 100, message = "邮箱长度必须介于 0 和 100 之间")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		if(null!=email&&email.length()>100){
			this.email = email.substring(0,100);
		}else{
			this.email = email;
		}
	}

	@Length(min = 0, max = 32, message = "分配执行人ID长度必须介于 0 和 32 之间")
	public String getExecutorId() {
		return executorId;
	}

	public void setExecutorId(String executorId) {
		this.executorId = executorId;
	}

	@Length(min = 0, max = 32, message = "用户一级分组长度必须介于 0 和 32 之间")
	public String getGroup1Id() {
		return group1Id;
	}

	public void setGroup1Id(String group1Id) {
		this.group1Id = group1Id;
	}

	@Length(min = 0, max = 32, message = "用户二级分组长度必须介于 0 和 32 之间")
	public String getGroup2Id() {
		return group2Id;
	}

	public void setGroup2Id(String group2Id) {
		this.group2Id = group2Id;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}

	public Integer getMergerNum() {
		return mergerNum;
	}

	public void setMergerNum(Integer mergerNum) {
		this.mergerNum = mergerNum;
	}

	//重复数据和新添加的数据字符串
	public String getRepeatAndNew() {
		return mergerNum + "(" + noReadMergerNum + ")";
	}


	@Length(min = 0, max = 100, message = "手机长度必须介于 0 和 100 之间")
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		if(null!=mobile&&mobile.length()>100){
			this.mobile = mobile.substring(0,100);
		}else{
			this.mobile = mobile;
		}
	}

	@Length(min = 0, max = 10, message = "设备来源长度必须介于 0 和 10 之间")
	public String getMobileOrPc() {
		return mobileOrPc;
	}

	public void setMobileOrPc(String mobileOrPc) {
		this.mobileOrPc = mobileOrPc;
	}

	public String getMobileOrPcText() {
		return DictUtils.getDictLabel(mobileOrPc, "POTENTIAL_SOURCE", "电脑");
	}

	public Integer getNoReadMergerNum() {
		return noReadMergerNum;
	}

	public void setNoReadMergerNum(Integer noReadMergerNum) {
		this.noReadMergerNum = noReadMergerNum;
	}

	@JsonBackReference
	public PotentialCustomer getParent() {
		return parent;
	}

	public void setParent(PotentialCustomer parent) {
		this.parent = parent;
	}

	@Length(min = 0, max = 32, message = "省份长度必须介于 0 和 32 之间")
	public String getProvinceId() {
		return provinceId;
	}

	public void setProvinceId(String provinceId) {
		this.provinceId = provinceId;
	}

	@Length(min = 0, max = 32, message = "真实管理员分组长度必须介于 0 和 32 之间")
	public String getRealAdminGroupId() {
		return realAdminGroupId;
	}

	public void setRealAdminGroupId(String realAdminGroupId) {
		this.realAdminGroupId = realAdminGroupId;
	}

	@Length(min = 0, max = 32, message = "真实用户分组长度必须介于 0 和 32 之间")
	public String getRealGroupId() {
		return realGroupId;
	}

	public void setRealGroupId(String realGroupId) {
		this.realGroupId = realGroupId;
	}

	@Length(min = 0, max = 50, message = "可信 类型长度必须介于 0 和 50 之间")
	public String getSealVersionType() {
		return sealVersionType;
	}

	public void setSealVersionType(String sealVersionType) {
		this.sealVersionType = sealVersionType;
	}

	@Length(min = 0, max = 100, message = "一级来源长度必须介于 0 和 100 之间")
	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		if(null!=source&&source.length()>100){
			this.source = source.substring(0,100);
		}else{
			this.source = source;
		}
	}

	@Length(min = 0, max = 100, message = "二级来源长度必须介于 0 和 100 之间")
	public String getSourceDesc() {
		return sourceDesc;
	}

	public void setSourceDesc(String sourceDesc) {
		if(null!=sourceDesc&&sourceDesc.length()>100){
			this.sourceDesc = sourceDesc.substring(0,100);
		}else{
			this.sourceDesc = sourceDesc;
		}
	}

	@Length(min = 0, max = 100, message = "电话长度必须介于 0 和 100 之间")
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		if(null!=telephone&&telephone.length()>100){
			this.telephone = telephone.substring(0,100);
		}else{
			this.telephone = telephone;
		}
	}

	@Length(min = 0, max = 250, message = "访问记录长度必须介于 0 和 250 之间")
	public String getVisitRecord() {
		return visitRecord;
	}

	public void setVisitRecord(String visitRecord) {
		if(null!=visitRecord&&visitRecord.length()>250){
			this.visitRecord = visitRecord.substring(0,250);
		}else{
			this.visitRecord = visitRecord;
		}
	}

	@Length(min = 0, max = 255, message = "访问结果长度必须介于 0 和 255 之间")
	public String getVisitResult() {
		return visitResult;
	}

	public void setVisitResult(String visitResult) {
		if(null!=visitResult&&visitResult.length()>255){
			this.visitResult = visitResult.substring(0,255);
		}else{
			this.visitResult = visitResult;
		}
	}

	@Length(min = 0, max = 32, message = "访问结果附加ID长度必须介于 0 和 64 之间")
	public String getVisitResultDetailId() {
		return visitResultDetailId;
	}

	public void setVisitResultDetailId(String visitResultDetailId) {
		this.visitResultDetailId = visitResultDetailId;
	}

	public String getVisibilityUserName() {
		return visibilityUserName;
	}

	public void setVisibilityUserName(String visibilityUserName) {
		this.visibilityUserName = visibilityUserName;
	}

	@Length(min = 0, max = 50, message = "来源类型长度必须介于 0 和 50 之间")
	public String getSourceType() {
		return sourceType;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}

	@Length(min = 0, max = 32, message = "最后客户状态长度必须介于 0 和 32 之间")
	public String getLastCustomerStatusId() {
		return lastCustomerStatusId;
	}

	public void setLastCustomerStatusId(String lastCustomerStatusId) {
		this.lastCustomerStatusId = lastCustomerStatusId;
	}

	@Length(min = 0, max = 32, message = "最后客户状态明细长度必须介于 0 和 32 之间")
	public String getLastCustomerStatusDetailId() {
		return lastCustomerStatusDetailId;
	}

	public void setLastCustomerStatusDetailId(String lastCustomerStatusDetailId) {
		this.lastCustomerStatusDetailId = lastCustomerStatusDetailId;
	}

	public Integer getVisitNum() {
		return visitNum;
	}

	public void setVisitNum(Integer visitNum) {
		this.visitNum = visitNum;
	}

	public String getContact() {
		if ( visitNum != null && visitNum > 0) {
			return "是";
		}
		return "否";
	}

	@Length(min = 0, max = 8, message = "管理员是否拥有分组长度必须介于 0 和 8 之间")
	public String getHasAdminGroup() {
		return hasAdminGroup;
	}

	public void setHasAdminGroup(String hasAdminGroup) {
		this.hasAdminGroup = hasAdminGroup;
	}

	@Length(min = 0, max = 8, message = "用户是否拥有分组长度必须介于 0 和 8 之间")
	public String getHasGroup() {
		return hasGroup;
	}

	public void setHasGroup(String hasGroup) {
		this.hasGroup = hasGroup;
	}

	@Length(min = 0, max = 32, message = "最后访问ID长度必须介于 0 和 32 之间")
	public String getLastVisitId() {
		return lastVisitId;
	}

	public void setLastVisitId(String lastVisitId) {
		this.lastVisitId = lastVisitId;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDistDate() {
		return distDate;
	}

	public void setDistDate(Date distDate) {
		this.distDate = distDate;
	}

	@Length(min = 0, max = 32, message = "数据被分配人ID长度必须介于 0 和 32 之间")
	public String getDistUserId() {
		return distUserId;
	}

	public void setDistUserId(String distUserId) {
		this.distUserId = distUserId;
	}

	@Length(min = 0, max = 32, message = "客户特点长度必须介于 0 和 32 之间")
	public String getCustomerFeatureId() {
		return customerFeatureId;
	}

	public void setCustomerFeatureId(String customerFeatureId) {
		this.customerFeatureId = customerFeatureId;
	}

	@Length(min = 0, max = 32, message = "客户类型长度必须介于 0 和 32 之间")
	public String getCustomerTypeId() {
		return customerTypeId;
	}

	public void setCustomerTypeId(String customerTypeId) {
		this.customerTypeId = customerTypeId;
	}

	@Length(min = 0, max = 32, message = "客户类型附加类型长度必须介于 0 和 32 之间")
	public String getCustomerTypeDtailId() {
		return customerTypeDtailId;
	}

	public void setCustomerTypeDtailId(String customerTypeDtailId) {
		this.customerTypeDtailId = customerTypeDtailId;
	}

	public String getPrepaidMoney() {
		return prepaidMoney;
	}

	public void setPrepaidMoney(String prepaidMoney) {
		this.prepaidMoney = prepaidMoney;
	}

	@Length(min = 0, max = 50, message = "产品意向长度必须介于 0 和 50 之间")
	public String getTargetProducts() {
		return targetProducts;
	}

	public void setTargetProducts(String targetProducts) {
		if(null!=targetProducts&&targetProducts.length()>50){
			this.targetProducts = targetProducts.substring(0,50);
		}else{
			this.targetProducts = targetProducts;
		}
	}

	public String getTargetProductsText() {
		return ProductUtils.getEntityByValue(targetProducts).getProductTypeName();
	}

	@Length(min = 0, max = 4, message = "联系人性别长度必须介于 0 和 4 之间")
	public String getContactorSex() {
		return contactorSex;
	}

	public void setContactorSex(String contactorSex) {
		this.contactorSex = contactorSex;
	}

	@Length(min = 0, max = 50, message = "联系人职务长度必须介于 0 和 50 之间")
	public String getContactorPosition() {
		return contactorPosition;
	}

	public void setContactorPosition(String contactorPosition) {
		if(null!=contactorPosition&&contactorPosition.length()>50){
			this.contactorPosition = contactorPosition.substring(0,50);
		}else{
			this.contactorPosition = contactorPosition;
		}
	}

	@Length(min = 0, max = 100, message = "联系人QQ长度必须介于 0 和 100 之间")
	public String getContactorQq() {
		return contactorQq;
	}

	public void setContactorQq(String contactorQq) {
		if(null!=contactorQq&&contactorQq.length()>100){
			this.contactorQq = contactorQq.substring(0,100);
		}else{
			this.contactorQq = contactorQq;
		}
	}

	@Length(min = 0, max = 100, message = "联系人微信长度必须介于 0 和 100 之间")
	public String getContactorWechat() {
		return contactorWechat;
	}

	public void setContactorWechat(String contactorWechat) {
		if(null!=contactorWechat&&contactorWechat.length()>100){
			this.contactorWechat = contactorWechat.substring(0,100);
		}else{
			this.contactorWechat = contactorWechat;
		}
	}

	public Integer getWeight() {
		return weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	@Length(min = 0, max = 32, message = "数据访问规则长度必须介于 0 和 32 之间")
	public String getRecordVisibilityRule() {
		return recordVisibilityRule;
	}

	public void setRecordVisibilityRule(String recordVisibilityRule) {
		this.recordVisibilityRule = recordVisibilityRule;
	}

	public String getVisibilityUserId() {
		return visibilityUserId;
	}

	public void setVisibilityUserId(String visibilityUserId) {
		this.visibilityUserId = visibilityUserId;
	}

	@Length(min = 0, max = 100, message = "备用电话长度必须介于 0 和 100 之间")
	public String getBackupTelephone() {
		return backupTelephone;
	}

	public void setBackupTelephone(String backupTelephone) {
		if(null!=backupTelephone&&backupTelephone.length()>50){
			this.backupTelephone = backupTelephone.substring(0,50);
		}else{
			this.backupTelephone = backupTelephone;
		}
	}

	@Length(min = 0, max = 50, message = "行业长度必须介于 0 和 50 之间")
	public String getIndustry() {
		return industry;
	}

	public void setIndustry(String industry) {
		if(null!=industry&&industry.length()>50){
			this.industry = industry.substring(0,50);
		}else{
			this.industry = industry;
		}
	}

	@Length(min = 0, max = 100, message = "公司地址长度必须介于 0 和 100 之间")
	public String getCorporationAddress() {
		return corporationAddress;
	}

	public void setCorporationAddress(String corporationAddress) {
		if(null!=corporationAddress&&corporationAddress.length()>100){
			this.corporationAddress = corporationAddress.substring(0,100);
		}else{
			this.corporationAddress = corporationAddress;
		}
	}

	@Length(min = 0, max = 1, message = "删除标识长度必须介于 0 和 1 之间")
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public String getCustomerStatus() {
		return customerStatus;
	}

	public void setCustomerStatus(String customerStatus) {
		this.customerStatus = customerStatus;
	}

	public String getLastCustomerStatus() {
		return lastCustomerStatus;
	}

	public void setLastCustomerStatus(String lastCustomerStatus) {
		this.lastCustomerStatus = lastCustomerStatus;
	}

	public String[] getIds() {
		return ids;
	}

	public void setIds(String[] ids) {
		this.ids = ids;
	}

	public Integer getFlag() {
		return flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}
	
	public String getCustomerStatusFreeze() {
		if (customerStatusFreeze != null) {
			return customerStatusFreeze;
		}
		return DictUtils.getDictValue("客户状态-无意向", "CUSTOMER_STATUS_FREEZE", "");
	}

	public void setCustomerStatusFreeze(String customerStatusFreeze) {
		this.customerStatusFreeze = customerStatusFreeze;
	}

	public String getFreezeExp() {
		return FreezeExp;
	}

	public void setFreezeExp(String freezeExp) {
		FreezeExp = freezeExp;
	}

	public void clearGroup() {
		this.setRealGroupId(null);
		this.setGroup1Id(null);
		this.setGroup2Id(null);
		this.setHasGroup(null);
	}

	public void setGroup(String group1Id, String group2Id) {
		if (group1Id == null) {
			this.clearGroup();
			return;
		}
		this.setGroup1Id(group1Id);
		this.setGroup2Id(group2Id);
		if (group1Id != null && group2Id == null) {
			this.setRealGroupId(group1Id);
			this.setHasGroup("yes");
		}
		if (group1Id != null && group2Id != null) {
			this.setRealGroupId(group2Id);
			this.setHasGroup("yes");
		}
	}

	public void clearAdminGroup() {
		this.setRealAdminGroupId(null);
		this.setAdminGroup1Id(null);
		this.setAdminGroup2Id(null);
		this.setAdminGroup3Id(null);
	}


	public void setAdminGroup(String adminGroup1Id, String adminGroup2Id, String adminGroup3Id) {
		if (adminGroup1Id != null) {
			if (adminGroup2Id != null) {
				if (adminGroup3Id != null) {
					this.setRealAdminGroupId(adminGroup3Id);
					this.setAdminGroup2Id(adminGroup2Id);
					this.setAdminGroup3Id(adminGroup3Id);
					this.setAdminGroup1Id(adminGroup1Id);
				} else {
					this.setRealAdminGroupId(adminGroup2Id);
					this.setAdminGroup2Id(adminGroup2Id);
					this.setAdminGroup3Id(null);
					this.setAdminGroup1Id(adminGroup1Id);
				}
			} else {
				this.setRealAdminGroupId(adminGroup1Id);
				this.setAdminGroup2Id(null);
				this.setAdminGroup3Id(null);
				this.setAdminGroup1Id(adminGroup1Id);
			}
			this.setHasAdminGroup("yes");
		} else {
			this.clearAdminGroup();
		}

	}

	@Override
	public void preInsert() {
		this.dateCreated = new Date();
		this.lastUpdated = new Date();
		super.preInsert();
	}

	@Override
	public void preUpdate() {
		this.lastUpdated = new Date();
		super.preUpdate();
	}

	@Override
	public boolean getIsNewRecord() {
		return version == null || super.getIsNewRecord();
	}

	public String getExecutorName() {
		return executorName;
	}

	public void setExecutorName(String executorName) {
		this.executorName = executorName;
	}

	public int getCorporationNameOption() {
		return corporationNameOption;
	}

	public void setCorporationNameOption(int corporationNameOption) {
		this.corporationNameOption = corporationNameOption;
	}

	public int getContactorNameOption() {
		return contactorNameOption;
	}

	public void setContactorNameOption(int contactorNameOption) {
		this.contactorNameOption = contactorNameOption;
	}

	public int getMobileOption() {
		return mobileOption;
	}

	public void setMobileOption(int mobileOption) {
		this.mobileOption = mobileOption;
	}

	public int getTelephoneOption() {
		return telephoneOption;
	}

	public void setTelephoneOption(int telephoneOption) {
		this.telephoneOption = telephoneOption;
	}

	public int getSourceOption() {
		return sourceOption;
	}

	public void setSourceOption(int sourceOption) {
		this.sourceOption = sourceOption;
	}

	public int getSourceDescOption() {
		return sourceDescOption;
	}

	public void setSourceDescOption(int sourceDescOption) {
		this.sourceDescOption = sourceDescOption;
	}

	public int getCorporationUrlOption() {
		return corporationUrlOption;
	}

	public void setCorporationUrlOption(int corporationUrlOption) {
		this.corporationUrlOption = corporationUrlOption;
	}

	public int getEmailOption() {
		return emailOption;
	}

	public void setEmailOption(int emailOption) {
		this.emailOption = emailOption;
	}

	public int getDateVisitOption() {
		return dateVisitOption;
	}

	public void setDateVisitOption(int dateVisitOption) {
		this.dateVisitOption = dateVisitOption;
	}

	public String getDateVisitBeginDate() {
		return dateVisitBeginDate;
	}

	public void setDateVisitBeginDate(String dateVisitBeginDate) {
		this.dateVisitBeginDate = dateVisitBeginDate;
	}

	public String getDateVisitEndDate() {
		return dateVisitEndDate;
	}

	public void setDateVisitEndDate(String dateVisitEndDate) {
		this.dateVisitEndDate = dateVisitEndDate;
	}

	public int getDateAppointmentOption() {
		return dateAppointmentOption;
	}

	public void setDateAppointmentOption(int dateAppointmentOption) {
		this.dateAppointmentOption = dateAppointmentOption;
	}

	public String getDateAppointmentBeginDate() {
		return dateAppointmentBeginDate;
	}

	public void setDateAppointmentBeginDate(String dateAppointmentBeginDate) {
		this.dateAppointmentBeginDate = dateAppointmentBeginDate;
	}

	public String getDateAppointmentEndDate() {
		return dateAppointmentEndDate;
	}

	public void setDateAppointmentEndDate(String dateAppointmentEndDate) {
		this.dateAppointmentEndDate = dateAppointmentEndDate;
	}

	public int getDistDateOption() {
		return distDateOption;
	}

	public void setDistDateOption(int distDateOption) {
		this.distDateOption = distDateOption;
	}

	public String getDistDateBeginDate() {
		return distDateBeginDate;
	}

	public void setDistDateBeginDate(String distDateBeginDate) {
		this.distDateBeginDate = distDateBeginDate;
	}

	public String getDistDateEndDate() {
		return distDateEndDate;
	}

	public void setDistDateEndDate(String distDateEndDate) {
		this.distDateEndDate = distDateEndDate;
	}
	
	
}